$().ready(function () {
    getPhotoType();
});

function uploadImg() {
    var formData = new FormData($('#upload_form')[0]);
    $.ajax({
        url : "/api/v1/upload",
        method : "POST",
        data: formData,
        processData: false,
        contentType: false,
        enctype: "multipart/form-data",
        success : function (result) {
            alert(result)
        }
    })
}

/**
 * 获取全部照片分类
 */
function getPhotoType() {
    $.ajax({
        url:"/api/v1/photo_type",
        method:"GET",
        success : function (result) {
            console.log("获取成功");
        }
    })
}

/**
 * 创建照片分类
 */
function createPhotoType() {
    var photoType = {
        photoType:$('#create_photo_type').val(),
        cnPhotoType:$('#create_cn_photo_type').val()
    };
    $.ajax({
        url : "/api/v1/photo_type",
        method : "POST",
        data : JSON.stringify(photoType),
        success : function () {
            console.log("create success!");
        }
    })
}